package test.abc.spring.app2.assembly;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * 应用上下文
 * 
 * @author song.hus
 */
public class ApplicationContextE {

    private Logger logger = Logger.getLogger(ApplicationContextE.class);

    public static void main(String[] args) throws Exception {
        PropertyConfigurator.configure("src/log4j.properties");
        ApplicationContext context = new FileSystemXmlApplicationContext(
                                                                         "src/main/java/test/abc/spring/app2/assembly/BeanTest.xml");
        // TODO 路径问题没有解决
        // ApplicationContext context = new ClassPathXmlApplicationContext(
        // "Hello.xml");
        GameService gameService = (GameService) context.getBean("gameService");
        gameService.play();
        Game game1 = (Game) context.getBean("game1");
        System.out.println(game1);
    }
}
